package com.koron.css2.newProjectCenter.mapper;

import com.koron.css2.newProjectCenter.bean.query.PubUpMaterialTypeQueryBean;
import com.koron.css2.newProjectCenter.vo.PubUpMaterialTypeListVO;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface PubUpMaterialTypeMapper {

    List<PubUpMaterialTypeListVO> selectList(PubUpMaterialTypeQueryBean bean);

    int updateOrSave(PubUpMaterialTypeQueryBean bean);
    
    // 获取父级id为当前id的数量
    int getCountByCurrentId(@Param("currentId") String currentId);

    int delete(@Param("id") String id);

    @Select("select count(0) from pub_up_material where type_id = #{materialTypeId} and is_deleted = false")
    int getCountByMaterialTypeId(@org.apache.ibatis.annotations.Param("materialTypeId") String materialTypeId);

    @Select("select code from pub_up_material_type where id = #{parentId} and is_deleted = 0")
    String getCodeById(@Param("parentId") String parentId);
}
